<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        class Person {
            constructor(name, sex, age) {
                this.name = name;
                this.sex = sex;
                this.age = age;
            }
            play() {
                console.log('have fun')
            }
        }
        var zs = new Person('zs', 'boy', '33')
        console.log(zs)

        // es6的继承
        class P extends Person {
            constructor(name, sex, age, hobby) {
                super(name, sex, age);
                this.hobby = hobby;
            }
            lang() {
                console.log('刀尖上起舞')
            }

        }

        var ls = new P('li', 'boy', '29', 'rap')
        console.log(ls);
        ls.lang()
        ls.play()


    </script>
</body>

</html>